package uk.ac.cam.cl.projectcharlie2010.physicalboard;

import java.awt.image.BufferedImage;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;


public class SuggestionsForSerialisation {



	public static void main(String args[]) {
		
		//STORE
		FileOutputStream fos = null;
		ObjectOutputStream oos = null;
		
		try {
			fos = new FileOutputStream("somefilename");
			oos = new ObjectOutputStream(fos);
			oos.writeObject(new Object()); //TODO correct object;
			oos.close();
		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		
		//LOAD
		
		try {
			FileInputStream fis = new FileInputStream("somefilename");
			ObjectInputStream ois = new ObjectInputStream(fis);
			
			BufferedImage img = (BufferedImage) ois.readObject();
		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (ClassNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
	}


}
